#include "Tree.h"

BTNode* ByeNode(BTDataType x)
{
	BTNode* root = (BTNode*)malloc(sizeof(BTNode));
	if (root == NULL)
	{
		perror("malloc fail!");
		exit(1);
	}
	root->data = x;
	root->left = root->right = NULL;
	return root;
}

BTNode* createBinaryTree()
{
	BTNode* rootA = ByeNode('A');
	BTNode* rootB = ByeNode('B');
	BTNode* rootC = ByeNode('C');
	BTNode* rootD = ByeNode('D');
	BTNode* rootE = ByeNode('E');
	BTNode* rootF = ByeNode('F');

	rootA->left = rootB;
	rootA->right = rootC;
	rootB->left = rootD;
	rootC->left = rootE;
	rootC->right = rootF;

	return rootA;
}

void test()
{
	BTNode* root = createBinaryTree();
	preOrder(root);
	printf("\n");
	inOrder(root);
	printf("\n");
	postOrder(root);
	printf("\n");
}

int main()
{
	test();
	return 0;
}